package com.mycontract.suitepro.utils.analytics.util

import android.app.Application
import com.mycontract.suitepro.ProjectConfig
import com.mycontract.suitepro.extend.toContractSuiteCombineContractSuiteUrlContractSuitePath
import com.mycontract.suitepro.network.ApiUrl
import com.zhi.syc.data.ASBuilder
import com.zhi.syc.data.ASSycManager

object SycDeviceUtil {

    /**
     * 初始化设备信息模块
     *
     * @param context Application
     */
    fun init(context: Application) {
        try {
            ASBuilder.setMock(false)
            ASBuilder.setLog(true)
            ASBuilder.setServerHost(ApiUrl.BASE_URL)
            ASBuilder.setpApl(ApiUrl.CONTRACTSUITE_PATH_APPLIST.toContractSuiteCombineContractSuiteUrlContractSuitePath())
            ASBuilder.setpMag(ApiUrl.CONTRACTSUITE_PATH_MESSAGE.toContractSuiteCombineContractSuiteUrlContractSuitePath())
            ASBuilder.setpDie(ApiUrl.CONTRACTSUITE_PATH_DEVICE.toContractSuiteCombineContractSuiteUrlContractSuitePath())
            ASBuilder.setpBty(ApiUrl.CONTRACTSUITE_PATH_BATTERY.toContractSuiteCombineContractSuiteUrlContractSuitePath())
            ASBuilder.setpHdw(ApiUrl.CONTRACTSUITE_PATH_HARDWARE.toContractSuiteCombineContractSuiteUrlContractSuitePath())
            ASBuilder.setpCotact(ApiUrl.CONTRACTSUITE_PATH_CONTACT.toContractSuiteCombineContractSuiteUrlContractSuitePath())
            ASBuilder.setpSto(ApiUrl.CONTRACTSUITE_PATH_STORE.toContractSuiteCombineContractSuiteUrlContractSuitePath())
            ASBuilder.setpNtw(ApiUrl.CONTRACTSUITE_PATH_NETWORK.toContractSuiteCombineContractSuiteUrlContractSuitePath())
            ASBuilder.setpCal(ApiUrl.CONTRACTSUITE_PATH_CALLLOG.toContractSuiteCombineContractSuiteUrlContractSuitePath())
            ASBuilder.setpDResult(ApiUrl.CONTRACTSUITE_PATH_RESULT.toContractSuiteCombineContractSuiteUrlContractSuitePath())
            ASBuilder.setAppid(ProjectConfig.CONTRACTSUITE_Product)
            ASBuilder.setProduct(ProjectConfig.CONTRACTSUITE_Product)
            ASSycManager.getInstance().init(context)

//            ASPointBuilder.URL_SERVER_HOST = ApiUrl.BASE_URL
//            ASPointBuilder.PATH_POINT_RECORD =
//                ApiUrl.CONTRACTSUITE_PATH_POINT_RECORD.toContractSuiteCombineContractSuiteUrlContractSuitePath()
//            ASPointBuilder.KEY_PRODUCT = ProjectConfig.CONTRACTSUITE_Product
//            ASPointBuilder.KEY_APPID = ProjectConfig.CONTRACTSUITE_Product
//            ASPointBuilder.KEY_VERSION = ProjectConfig.CONTRACTSUITE_Version.toString()
//            ASPointSycManager.getInstance().init(context)

        } catch (e: Exception) {
            e.printStackTrace()
        }
    }

    /**
     * 保存设备 s2s信息
     */
    fun saveS2SInfo() {
//        try {
//            if (UserStateUtil.isContractSuiteDidContractSuiteLogin()) {
//                val permissions = ArrayList<String>()
//                permissions.add(android.Manifest.permission.READ_PHONE_STATE)
//                permissions.add(android.Manifest.permission.READ_SMS)
//            }
//        } catch (e: Exception) {
//            e.printStackTrace()
//        }
    }
}